﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YQGL.Common;

namespace YQGL.Controllers
{
    public class EnterpriseDetailController : EnterpriseBaseController
    {
        BLL.DJ_QYXX QYXXBLL = new BLL.DJ_QYXX();
        BLL.DM_QYDL DLBLL = new BLL.DM_QYDL();
        BLL.DM_QYLX LXBLL = new BLL.DM_QYLX();
        BLL.DM_QYLXMX MXBLL = new BLL.DM_QYLXMX();
        BLL.dm_SDYSX SXBLL = new BLL.dm_SDYSX();
        BLL.dm_SDYSX1 SX1BLL = new BLL.dm_SDYSX1();
        BLL.dm_SDYSX2 SX2BLL = new BLL.dm_SDYSX2();
        BLL.dm_SDYSX3 SX3BLL = new BLL.dm_SDYSX3();
        BLL.dm_SDYSX4 SX4BLL = new BLL.dm_SDYSX4();
        BLL.dm_SDYSX5 SX5BLL = new BLL.dm_SDYSX5();
        BLL.DJ_QYZCXX DJ_QYZCXXBLL = new BLL.DJ_QYZCXX();
        //
        // GET: /EnterpriseDetail/

        public ActionResult Index(string ZCH)
        {
           
            Model.DJ_QYXX mdl = QYXXBLL.GetModel(ZCH);


            List<SelectListItem> DLList = DLBLL.GetModelList("").Select(h => new SelectListItem() { Text = h.qydl_mc, Value = h.qydl_dm }).ToList();

            List<SelectListItem> LXList = new List<SelectListItem>();

            List<SelectListItem> MXList = new List<SelectListItem>();



            List<SelectListItem> SXList = SXBLL.GetModelList("Yxbz=1").Select(h => new SelectListItem() { Text = h.SDYSX_MC, Value = h.SDYSX_dm }).ToList();
            ;
            List<SelectListItem> SX1List = SX1BLL.GetModelList("").Select(h => new SelectListItem() { Text = h.SDYSX1_MC, Value = h.SDYSX1_dm }).ToList();

            List<SelectListItem> SX2List = SX2BLL.GetModelList("").Select(h => new SelectListItem() { Text = h.SDYSX2_MC, Value = h.SDYSX2_dm }).ToList();

            List<SelectListItem> SX3List = SX3BLL.GetModelList("").Select(h => new SelectListItem() { Text = h.SDYSX3_MC, Value = h.SDYSX3_dm }).ToList();

            List<SelectListItem> SX4List = SX4BLL.GetModelList("").Select(h => new SelectListItem() { Text = h.SDYSX4_MC, Value = h.SDYSX4_dm }).ToList();

            List<SelectListItem> SX5List = SX5BLL.GetModelList("").Select(h => new SelectListItem() { Text = h.SDYSX5_MC, Value = h.SDYSX5_dm }).ToList();



            mdl.QYDL_MC = DLList.FirstOrDefault(h => h.Value.Trim() == mdl.QYDL_DM) == null ? "" : DLList.FirstOrDefault(h => h.Value.Trim() == mdl.QYDL_DM).Text;
            mdl.QYLX_MC = LXList.FirstOrDefault(h => h.Value.Trim() == mdl.QYLX_DM) == null ? "" : LXList.FirstOrDefault(h => h.Value.Trim() == mdl.QYLX_DM).Text;
            mdl.QYLXMX_MC = MXList.FirstOrDefault(h => h.Value.Trim() == mdl.QYLXMX_DM) == null ? "" : MXList.FirstOrDefault(h => h.Value.Trim() == mdl.QYLXMX_DM).Text;
            mdl.SDYSX1_MC = SX1List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX1_DM) == null ? "" : SX1List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX1_DM).Text;
            mdl.SDYSX2_MC = SX2List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX2_DM) == null ? "" : SX2List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX2_DM).Text;
            mdl.SDYSX3_MC = SX3List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX3_DM) == null ? "" : SX3List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX3_DM).Text;
            mdl.SDYSX4_MC = SX4List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX4_DM) == null ? "" : SX4List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX4_DM).Text;
            mdl.SDYSX5_MC = SX5List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX5_DM) == null ? "" : SX5List.FirstOrDefault(h => h.Value.Trim() == mdl.SDYSX5_DM).Text;
           
            return View("Index",mdl);
        }

    }
}
